package com.winchain.chainbill.bill.biz.send.cmd;

import com.shell.bee.acct.transaction.po.AcctTxRec;
import com.shell.framework.command.CallbackContext;
import com.shell.framework.command.CommandContext;
import com.shell.framework.command.ICallback;
import com.shell.framework.command.ICommand;
import com.winchain.chainbill.bill.base.po.CbOpt;
import com.winchain.chainbill.bill.biz.Bill;
import com.winchain.chainbill.bill.biz.send.service.BillMoveService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class BillMoveCmd<T> implements ICommand<Bill<T>>, ICallback<Bill<T>, AcctTxRec> {
	@Autowired
	private BillMoveService billMoveService;

	public boolean execute(CommandContext<Bill<T>> context) throws Exception {
		this.billMoveService.move(((Bill) context.getSource()).getRec(), (CbOpt) context.getValue("Operation"));
		return false;
	}

	public boolean callback(CallbackContext<Bill<T>, AcctTxRec> context) throws Exception {
		execute(context);
		return false;
	}
}
